package com.mk.carcassonne;

import com.mk.carcassonne.drawables.BitmapCache;
import com.mk.carcassonne.drawables.BrickFactory;
import com.mk.carcassonne.drawables.BrickRepository;

import android.app.Activity;
import android.util.DisplayMetrics;

public class Global {
	public static int SCREEN_SIZE_X;
	public static int SCREEN_SIZE_Y;
	
	public static int COMMAND_BAR_HEIGHT;
	
	public static int BRICK_SIZE;
	public static int FOLLOWER_SIZE;
	public static int DEFAULT_ROTATION = 90;
	
	public static BrickRepository BrickRepository;
	public static BrickFactory BrickFactory;
	public static BitmapCache BitmapRepository;
	
	public static SoundManager SoundManager;
	
	public static FollowerService FollowerService;
	
	
	public static void init(Activity activity)
	{
		DisplayMetrics dm = new DisplayMetrics();
		activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
		
		SCREEN_SIZE_X = dm.widthPixels;
		SCREEN_SIZE_Y = dm.heightPixels;
		
		if(dm.densityDpi <= 120)
			{
				BRICK_SIZE = 30;
				FOLLOWER_SIZE = 9;
			}
		else if(dm.densityDpi <= 160)
			{
				BRICK_SIZE = 40;
				FOLLOWER_SIZE = 12;
			}
		else
			{
				BRICK_SIZE = 60;
				FOLLOWER_SIZE = 18;
			}
		
		COMMAND_BAR_HEIGHT = BRICK_SIZE + 20;
		
		BitmapRepository = new BitmapCache(activity);
		BrickFactory = new BrickFactory(BitmapRepository);
		BrickRepository = new BrickRepository(BrickFactory);
		
		SoundManager = new SoundManager(activity);
		
		FollowerService = new FollowerService();
	}
}
